import axios from 'axios';

const OrderService = {
  // 获取用户订单列表
  getUserOrders: async (userId) => {
    const response = await axios.get(`/api/orders/user/${userId}`);
    return response.data;
  },

  // 创建新订单
  createOrder: async (orderData) => {
    const response = await axios.post('/api/orders', orderData);
    return response.data;
  },

  // 删除订单
  deleteOrder: async (orderId) => {
    const response = await axios.delete(`/api/orders/${orderId}`);
    return response.data;
  },

  // 更新订单状态
  updateOrderStatus: async (orderId, status) => {
    const response = await axios.patch(`/api/orders/${orderId}/status`, { status });
    return response.data;
  },

  // 获取订单详情
  getOrderDetails: async (orderId) => {
    const response = await axios.get(`/api/orders/${orderId}`);
    return response.data;
  }
};

export default OrderService; 